﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="admin_popedom.aspx.cs"
    Inherits="PeisongWeb.admin.admin_popedom" %>

<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<%@ Register TagName="menu" Src="controls/menu.ascx" TagPrefix="uc2" %>
<%@ Register TagName="top" Src="controls/top.ascx" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>管理员权限列表</title>
    <!--#include file="style.inc"-->
    <%--    <script language="javascript" type="text/javascript" src="../app_common/scripts/jquery-cn.js"></script>--%>

    <script type="text/javascript">


        //    function displayChkbox()
        //    {
        //        
        //        if(document.getElementById("hid_Popedom").value!="")
        //        {
        //            
        //            bindChkbox(document.getElementById("hid_Popedom").value);
        //        }
        //        
        //        
        //    }
        //    function bindChkbox(_hid_Popedom)
        //    {
        //        //alert(_hid_Popedom)
        //        var strs = _hid_Popedom.split(",");
        //        var strs_new="";
        //        for(var i=0;i<strs.length;i++)
        //        {
        //            
        //           strs_new=strs[i];
        //           //alert(strs_new.substring(0, 1)+""+strs_new.substring(1, 2));
        //          
        //           withchk(strs_new.substring(0, 1),strs_new.substring(1, 2));//IE
        //           initChkPopedom(strs_new.substring(0, 1),strs_new)//IE
        //           //withchk(strs[i][0],strs[i][1]);//FF
        //           //initChkPopedom(strs[i][0],strs[i]) //FF
        //        
        //        }
        //      
        //    }
        //    function initChkPopedom(code,value)
        //    {
        //       
        //        var len=document.getElementsByName("chk_popedom").length;
        //     
        //       
        //        for(i=0;i<len/4;i++)
        //        {
        //            if( document.getElementById("hid_chkPopedom"+i).value==code)
        //            {
        //                document.getElementById("hid_chkPopedom"+i).value=value;        
        //            }
        //        }
        //       
        //    }

        function withchk(code, value) {
            for (var i = 1; i <= value; i++) {

                document.getElementById(code + i).checked = true;
            }

        }

        function withoutchk(code, value) {
            for (var i = 1; i <= 2; i++) {

                document.getElementById(code + i).checked = false;
            }

        }


        function getPopedom() {
            var ret = "";
            var len = document.getElementsByName("chk_popedom").length;
            //alert(len);

            for (i = 0; i < len / 3; i++) {
                if (document.getElementById("hid_chkPopedom" + i).value != "") {
                    ret += (ret == "" ? "" : ",") + document.getElementById("hid_chkPopedom" + i).value;
                }
            }
            
            document.getElementById("hid_Popedom").value = ret;


            if (ret != "")
                return true;
            else
                return false;

        }

        function selChkBox(code, value, index, flag) {

            //alert(code + "   " + value + "   " + index)
            var obj = document.getElementById(code + value);
            if (obj.checked == true) {
                if (flag == 1) {
                    withchk(code, value);
                } else {
                    obj.checked = true;
                }

                document.getElementById("hid_chkPopedom" + index).value = code + value;

            }
            else {
                if (flag == 1) {
                    withoutchk(code, value);
                } else {
                    obj.checked = false;
                }
                // last modified(2010-04-13) by tianzh
                var o2 = document.getElementById(code + "2");
                var o1 = document.getElementById(code + "1");

                if (o1.checked || o2.checked) {
                    if (o2.checked) {
                        document.getElementById("hid_chkPopedom" + index).value = code + "2";
                    } else if (o1.checked) {
                        document.getElementById("hid_chkPopedom" + index).value = code + "1";
                    }
                } else {
                    document.getElementById("hid_chkPopedom" + index).value = "";
                }
            }
        }

    </script>

</head>
<body>
    <form id="form1" runat="server">
    <ext:ScriptManager ID="ScriptManager1" runat="server" />
    <uc1:top ID="Top1" runat="server" />
    <uc2:menu ID="Menu1" runat="server" />
    <div id="admin_main" style="margin: 10px 0 0 10px;">
        <ext:Panel ID="Panel2" runat="server" Title="管理员权限" BodyStyle="padding:5px 5px 0"
            Width="600" Frame="true" ButtonAlign="Center">
            <Body>
                <ext:Panel ID="Panel3" runat="server">
                    <Body>
                        <ext:ColumnLayout ID="ColumnLayout1" runat="server">
                            <ext:LayoutColumn ColumnWidth=".5">
                                <ext:Panel ID="Panel4" runat="server" Border="false" Header="false">
                                    <Body>
                                        <div id="admin_edit_content">
                                            <ul>
                                                <li style="border-bottom: 2px solid #99bbe8; height: auto;">
                                                    <label style="width: 50px; font-weight: bold;">
                                                        用户名:
                                                    </label>
                                                    <asp:Label CssClass="red" runat="server" ID="lbl_SysAdminName"></asp:Label>
                                                </li>
                                            </ul>
                                            <ul>
                                                <asp:Repeater ID="rpt_list" runat="server">
                                                    <ItemTemplate>
                                                        <li style="font-weight: bold; margin-top: 10px; font-style: italic; font-size: 14px;
                                                            border-bottom: 1px solid #99bbe8; width: 100%; height: auto; <%#Eval("code").ToString()=="A"?"": "display:none" %>">
                                                            <label style="width: 150px;">
                                                                <div style="margin-left: 20px;">
                                                                    <%#Eval("name")%></div>
                                                            </label>
                                                        </li>
                                                        <li style="<%#Container.ItemIndex%2==0?"background-color:White;": "" %><%#Eval("code").ToString()=="A"?"display:none":"" %>">
                                                            <label style="width: 150px;">
                                                                <div style="margin-left: 20px;">
                                                                    <%#Eval("name")%></div>
                                                            </label>
                                                            <input id="<%#Eval("parentCode") %><%#Eval("code") %>1" name="chk_popedom" type="checkbox"
                                                                onclick="selChkBox('<%#Eval("parentCode") %><%#Eval("code") %>','1','<%#Container.ItemIndex %>',1)"
                                                                value="<%#Eval("parentCode") %><%#Eval("code") %>1" <%#Eval("isChecked")!=DBNull.Value?(Convert.ToInt32(Eval("isChecked"))>=1?"checked":""):"" %> />查看&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                            <input id="<%#Eval("parentCode") %><%#Eval("code") %>2" name="chk_popedom" type="checkbox"
                                                                onclick="selChkBox('<%#Eval("parentCode") %><%#Eval("code") %>','2','<%#Container.ItemIndex %>',1)"
                                                                value="<%#Eval("parentCode") %><%#Eval("code") %>2" <%#Eval("isChecked")!=DBNull.Value?(Convert.ToInt32(Eval("isChecked"))>=2?"checked":""):"" %> />编辑&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                            <%--<input id="<%#Eval("parentCode") %><%#Eval("code") %>3" name="chk_popedom"  
                                                     type="checkbox" onclick="selChkBox('<%#Eval("parentCode") %><%#Eval("code") %>','3','<%#Container.ItemIndex %>')"
                                                      value="<%#Eval("parentCode") %><%#Eval("code") %>3" disabled/>删除--%>
                                                            <input id="<%#Eval("parentCode") %><%#Eval("code") %>4" name="chk_popedom" type="checkbox"
                                                                onclick="selChkBox('<%#Eval("parentCode") %><%#Eval("code") %>','4','<%#Container.ItemIndex %>',0)"
                                                                value="<%#Eval("parentCode") %><%#Eval("code") %>4" <%#Eval("isChecked")!=DBNull.Value?(Convert.ToInt32(Eval("isChecked"))>=4?"checked":""):"" %> />审核&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                            <input id="hid_chkPopedom<%#Container.ItemIndex %>" type="hidden" value="<%#Eval("isChecked") != DBNull.Value ? Eval("parentCode").ToString() + Eval("code").ToString() + Eval("isChecked").ToString() : ""%>" />
                                                        </li>
                                                    </ItemTemplate>
                                                </asp:Repeater>
                                                <%-- <li>
                                        <label  style="width:150px;" >
                                           &nbsp;
                                            </label>
                                                     
                                          </li>  --%>
                                                <li>
                                                    <label style="width: 150px;">
                                                        &nbsp;
                                                    </label>
                                                    <asp:Button ID="bt_save" runat="server" OnClientClick="return getPopedom();" Text="保存"
                                                        OnClick="bt_save_Click" />
                                                    <input type="button" value="返回" onclick="javascript:window.location.href='sysAdminList.aspx';" />
                                                    <input id="hid_Popedom" runat="server" type="hidden" />
                                                </li>
                                            </ul>
                                        </div>
                                    </Body>
                                </ext:Panel>
                            </ext:LayoutColumn>
                        </ext:ColumnLayout>
                    </Body>
                </ext:Panel>
            </Body>
        </ext:Panel>
    </div>
    </form>
</body>
</html>
